Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor errors #118

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open

Refactor errors #118

wants to merge 7 commits into from

Conversation

zemanlx
Copy link

@zemanlx zemanlx commented Oct 10, 2019

I was looking at the codebase and thinking if I can make some part a bit nicer. Here is my first attempt.

I have:

  • added unit tests for ErrorFilter function to lock behaviour and be sure later that I am not changing it.
  • removed dead code
  • refactored ErrorFilter function to
    • return early
    • avoid else as much as possible
    • not duplicate work
    • decrease number of indented code
    • decrease brain buffer when reading code flow

I can do more PRs like this one if you find it useful.

rsp.Response == nil checked and modified earlier
so that it is possible to return early and remove else branches
and have less indented code.
NewResponse duplicates action taken later in code.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant